-
Notifications
You must be signed in to change notification settings - Fork 361
fix: Resolve entries against cwd #1091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
|
Size Change: 0 B Total Size: 65.9 kB ℹ️ View Unchanged
|
c4ef5dc to
4167d53
Compare
4167d53 to
0485a4c
Compare
| // Now that dirs have been cleared, reset the fixturePath back to the parent dir | ||
| if (fixtureDir.endsWith('-with-cwd')) { | ||
| fixturePath = resolve(FIXTURES_DIR, fixtureDir); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was super broken & went unnoticed for a long time.
Basically we make the assumption that a test fixture foo-with-cwd is testing --cwd ./foo, and to make sure we were clearing out past runs, set the fixture path to fixtures/foo-with-cwd/foo so that rimraf would clear out all test cases the same way. However, we never set this path back!
When it came time to get the build script & execute it, the CWD was /foo-with-cwd/foo... none of these nested directories actually had a build script defined, as it was meant to come from the parent, and so all of the -with-cwd tests were just running plain microbundle. The build script we provided for our tests was entirely ignored as the test was always ran from the incorrect working dir.
Easy fix though, we just have to reset it.
preactjs/preact#4677
tiny-globresolves againstopts.cwdor., and because we don't passcwdintotiny-glob, this can result in incorrect file paths when used with Microbundle's--cwdflag.Edit: Meant to open this as a draft, needs tests &
ideally errors thrown for missing inputsEdit2: Unfortunately we don't throw on missing inputs anywhere else so that'd be inconsistent.